import jsonp from 'common/js/jsonp.js'
import { commonParams } from './config'

export function getSingerList() {
  const url = 'https://u.y.qq.com/cgi-bin/musicu.fcg'
  /* eslint-disable */
  let randCallbackName = '__jp' + String(Math.random()).slice(2,8)

  let params = Object.assign({}, commonParams, {
    callback: randCallbackName,
    jsonpCallback: randCallbackName,
    g_tk: '1819849191',
    loginUin: 0,
    hostUin: 0,
    format: 'jsonp',
    notice: 0,
    platform: 'yqq',
    needNewCode: '0',
    data: JSON.stringify({"comm":{"ct":24,"cv":10000},"singerList":{"module":"Music.SingerListServer","method":"get_singer_list","param":{"area":-100,"sex":-100,"genre":-100,"index":-100,"sin":0,"cur_page":1}}})
  })
  return jsonp(url, params, { name: randCallbackName })
}


// 获取歌手详情列表
export function getSingerDetail(singermid) {
  const url = 'https://c.y.qq.com/v8/fcg-bin/fcg_v8_singer_track_cp.fcg'
  /* eslint-disable */
  let randCallbackName = '__jp' + String(Math.random()).slice(2,8)

  let params = Object.assign({}, commonParams, {
    g_tk: '1819849191',
    callback: randCallbackName,
    jsonpCallback: randCallbackName,
    loginUin: 0,
    hostUin: 0,
    format: 'jsonp',
    notice: 0,
    platform: 'yqq',
    needNewCode: '0',
    singermid: singermid,
    order: 'listen',
    begin: 0,
    num: 30,
    songstatus: '1'
  })
  return jsonp(url, params, { name: randCallbackName })
}
